package com.suxii.netty_demo.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.suxii.adapter.MessageAdapter;
import com.suxii.netty_demo.R;
import com.suxii.pojo.MessageMsg;

import java.util.ArrayList;
import java.util.List;

public class MessageActivity extends AppCompatActivity {

    private RecyclerView messageList;
    public static MessageAdapter messageAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message);

        messageList = findViewById(R.id.message_list);

        List<MessageMsg> list = new ArrayList<>();


        LinearLayoutManager manager = new LinearLayoutManager(this);
        messageList.setLayoutManager(manager);

        messageAdapter = new MessageAdapter(list, this);
        messageAdapter.findMessage();
        messageList.setAdapter(messageAdapter);


    }

    public void to_friend(View view) {
        Intent intent = new Intent(this, FriendActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        //messageAdapter.setMessageViewHolder();
    }
}